import { BooleanProperty, NumberProperty } from "xbsj-xe2/dist-node/xe2-base-objects";
import { PartialWithUndefinedReactivePropsToNativeProps, ReactivePropsToNativePropsAndChanged, extendClassProps } from "xbsj-xe2/dist-node/xe2-base-utils";
import { SceneObjectKey } from "xbsj-xe2/dist-node/xe2-utils";
import { ESGeoExtrudedPolygonUFMS } from "../ESGeoExtrudedPolygonUFMS";

/**
 * 测试 ModelSer使用的挤压多边形体
 */
export class ESGeoExtrudedPolygonUFMSFromLineString extends ESGeoExtrudedPolygonUFMS {
    static override readonly type = this.register('ESGeoExtrudedPolygonUFMSFromLineString', this, { chsName: 'ModelSer使用的地理多边形体', tags: ['ESObjects', '_ES_Impl_Cesium', '_ES_Impl_UE'], description: "地理多边形体" });
    override get typeName() { return 'ESGeoExtrudedPolygonUFMSFromLineString'; }
    override get defaultProps() { return ESGeoExtrudedPolygonUFMSFromLineString.createDefaultProps(); }
    override get json() { return this._innerGetJson() as JsonType; }
    override set json(value: JsonType) { this._innerSetJson(value); }

    static override defaults = {
        ...ESGeoExtrudedPolygonUFMS.defaults,
        width: 5,
    }

    constructor(id?: SceneObjectKey) {
        super(id);
        this.collision = false;
    }
    override getESProperties() {
        const properties = { ...super.getESProperties() };
        return {
            ...properties,
            coordinate: [
                ...properties.coordinate,
                new NumberProperty('宽度', '宽度', true, false, [this, 'width'], ESGeoExtrudedPolygonUFMSFromLineString.defaults.width),
                new BooleanProperty('编辑位置', '编辑位置', true, false, [this, 'positionEditing'], false)
            ]
        };
    };
    override getProperties(language: string) {
        return [
            ...super.getProperties(language),
            new NumberProperty('宽度', '宽度', true, false, [this, 'width'], ESGeoExtrudedPolygonUFMSFromLineString.defaults.width),
            new BooleanProperty('编辑位置', '编辑位置', true, false, [this, 'positionEditing'], false)
        ];
    }
}

export namespace ESGeoExtrudedPolygonUFMSFromLineString {
    export const createDefaultProps = () => ({
        ...ESGeoExtrudedPolygonUFMS.createDefaultProps(),
        width: undefined as number | undefined,
        positionEditing: false,
    });
}
extendClassProps(ESGeoExtrudedPolygonUFMSFromLineString.prototype, ESGeoExtrudedPolygonUFMSFromLineString.createDefaultProps);
export interface ESGeoExtrudedPolygonUFMSFromLineString extends ReactivePropsToNativePropsAndChanged<ReturnType<typeof ESGeoExtrudedPolygonUFMSFromLineString.createDefaultProps>> { }
type JsonType = PartialWithUndefinedReactivePropsToNativeProps<ReturnType<typeof ESGeoExtrudedPolygonUFMSFromLineString.createDefaultProps> & { type: string }>;